using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RuntimeCommand { 
public class HistoryStack 
{
    public Stack<string> oldData, newData;
    public HistoryStack(int size)
    {
        oldData= new Stack<string>(size);
        newData= new Stack<string>(size);
    }

    public bool GetOld(out string data)
    {
        data=string.Empty;
        if (oldData.Count == 0) return false;
        data= oldData.Pop();
        newData.Push(data);
        return true;
    }

    public bool GetNew(out string data)
    {
        data= string.Empty;
        if (newData.Count == 0) return false;
        data = newData.Pop();
        oldData.Push(data);
        return true;
    }

    public void EnQueue(string data)
    {
        oldData.Push(data);
    }
}
}